import request from '@/config/axios'
import type { Dayjs } from 'dayjs';

/** 模具出入库记录信息 */
export interface StockIoRecords {
          id: number; // 主键
          inOrOut?: number; // 出入库类型
          code?: string; // 单号
          deptId: number; // 部门Id
          warehouseId: number; // 仓库Id
          storageId: number; // 储位id
          accountId: number; // 模具Id
          drawingNoId?: number; // 图号id
          operatorId: number; // 操作人
          operateTime: string | Dayjs; // 操作时间
          description: string; // 描述
  }

// 模具出入库记录 API
export const StockIoRecordsApi = {
  // 查询模具出入库记录分页
  getStockIoRecordsPage: async (params: any) => {
    return await request.get({ url: `/mold/stock-io-records/page`, params })
  },

  // 查询模具出入库记录详情
  getStockIoRecords: async (id: number) => {
    return await request.get({ url: `/mold/stock-io-records/get?id=` + id })
  },

  // 新增模具出入库记录
  createStockIoRecords: async (data: StockIoRecords) => {
    return await request.post({ url: `/mold/stock-io-records/create`, data })
  },

  // 修改模具出入库记录
  updateStockIoRecords: async (data: StockIoRecords) => {
    return await request.put({ url: `/mold/stock-io-records/update`, data })
  },

  // 删除模具出入库记录
  deleteStockIoRecords: async (id: number) => {
    return await request.delete({ url: `/mold/stock-io-records/delete?id=` + id })
  },

  /** 批量删除模具出入库记录 */
  deleteStockIoRecordsList: async (ids: number[]) => {
    return await request.delete({ url: `/mold/stock-io-records/delete-list?ids=${ids.join(',')}` })
  },

  // 导出模具出入库记录 Excel
  exportStockIoRecords: async (params) => {
    return await request.download({ url: `/mold/stock-io-records/export-excel`, params })
  },
}